/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ejercicios;

import java.util.Scanner;

/**
 *
 * @author zpiik3
 */
public class Arreglo {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s;
        int c;
        int d=0;
        int n;
        System.out.println("Introduce una cadena");
        String cad = sc.next();
        String [] ar=cad.split("-");

        for(int x=1;x<ar.length;x+=2){
           c=Integer.parseInt(ar[x]);
           if(c>d){
                d=c;
           }
        }
         String fin[] = new String[d];
        for(int k=0;k<ar.length;k+=2){
            s=ar[k+1];
            n=Integer.parseInt(s);
            fin[n-1]=ar[k];
        }
         for(int y=0;y<fin.length;y++){

             if(fin[y]==null){
                fin[y]=" ";
             }
             System.out.print("|"+fin[y]);

         }
    }

}
